package data_structure.date12_22;

/**
 * 时间和空间复杂度
 */
public class Demo4 {
    //大O渐进表示法
    void func1(int N){//N^2
        int count = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                count ++;
            }
        }
        for (int i = 0; i < 2 * N; i++) {//2*N
            count++;
        }
        int M = 10;
        while((M--)>0){//10
            count++;
        }
        System.out.println(count);
    }

    void func2(int N){
        int count = 0;
        for (int i = 0; i < 2 * N; i++) {
            count ++;
        }
        int M = 10;
        while((M--) > 0){
            count ++;
        }
        System.out.println(count);
    }
    void func3(int N,int M){
        int count = 0;
        for (int i = 0; i < M; i++) {
            count++;
        }
        for (int j = 0; j < N; j++) {
            count++;
        }
        System.out.println(count);
    }
    void func4(int N){
        int count = 0;
        for (int i = 0; i < 100; i++) {
            count++;
        }
        System.out.println(count);
    }

    void bubbleSort(int[] array){
        for (int i = 0; i < array.length; i++) {
            boolean sorted = true;
            for (int j = 0; j < i; j++) {
                if(array[j-1] > array[j]){
                    Swap(array,j-1,j);
                    sorted = false;
                }
            }
            if(sorted == true){
                break;
            }
        }
    }

    private void Swap(int[] array, int i, int j) {
    }

    
}
